package com.util;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * 支付宝支付工具类
 */
public class ALiPayUtils {
    /*======沙箱环境=======*/
    //沙箱网关
    private static final String GATEWAY_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
    //沙箱APPID
    private static final String APP_ID = "9021000139670075";
    //自己应用私钥
    private static final String PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCussk9fC8rR/zKX+TZyJnKvXmJF+BonbGwevfNMq+9qm5CVEBIURud6lP19ncDQWmxP9IyvULy3tMnHrCvx2OvklZunChmIKI6HSlVP9cfdehLUJE9l/XKeS8yexb57emgcGFPZ7pyNjIusxAZdFdSz4WEnz9vj+dkASkrVttbFATqydQN8Cpu+m54UJfY8Yx95zzpi4VUCPpsQdPqFuZA90xOJOez6rHb4EULyQLfnghY87ATKr0VMTjnJXiYxM3f7NERL3vbTZ7HBTBIrHHQXHE5TWgjoVrvq7qnXozYd3RrTeU8myzRsWe9Br6sCXhb9qqHHE0SClU815k3W4jdAgMBAAECggEAMY/1eeUeeLf+pueXxJWd1B/3OAa3GtcKT1hDr0qfAz8z8st2RU4FeMK/OTvIPfsz4h6KIu0A7mh7HVEerW/y/x+UN+NDrt25SKV3UYFAJePMmHluCzxudhf1ZOv488Ukj+jyIpX6Fmb7y7XvbllMYOkRJzQKyjrYWc3egTYuG2NVYszqhEGlakG2PwXy3UIRs+Cp10RJ4+LJpGpboj3tA6OdSwxYnb2N7OqbJfh1qhaBK2O8ds+BI3q9zsdUlGd/1XbYtYFUHTSJR6UavjUxjY5gIn351Gsnl6rLQWUVi1aYdira6ZXs7GQGPzRiC7hlB+h4MtVXz73NvKe0LRO0YQKBgQDgLDdHud+od/GSZUKFI8IjRJcSvJTpdxdrLPve8WsoxItBC7Vg/gngp2djx3neXDwNxW/gaRVp5BFBlQ8KPW4F89JMhNB9lTU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VAj6bEHT6hbmQPdMTiTns+qx2+BFC8kC354IWPOwEyq9FTE45yV4mMTN3+zRES97202exwUwSKxx0FxxOU1oI6Fa76u6p16M2Hd0a03lPJss0bFnvQa+rAl4W/aqhxxNEgpVPNeZN1uI3QIDAQAB";
    //沙箱支付完成跳转页面
//    private static final String RETURN_URL = PropertiesValues.getPropertiesValue("pay.service.return_url", "application.properties");
//    //沙箱支付完成回调接口
//    private static final String NOTIFY_URL = PropertiesValues.getPropertiesValue("pay.service.notify_url", "application.properties");

    /*========基础数据===========*/
    //返回数据格式
    private static final String FORMAT = "json";
    //编码类型
    private static final String CHART_TYPE = "utf-8";
    //签名类型
    private static final String SIGN_TYPE = "RSA2";

    /*支付销售产品码,目前支付宝只支持FAST_INSTANT_TRADE_PAY*/
    public static final String PRODUCT_CODE = "FAST_INSTANT_TRADE_PAY";

    /*=====商户对应数据=====*/
    //商户PID
    public static final String PID = "2088721040586623";



}